﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using Common;

namespace CNCSoft.ErpApps.TMS.longGiaoVu
{
    public partial class frmAllTaskOfAUserDeadline : Form
    {
        SqlConnection conn = new SqlConnection(GlobalVariable.WSInfo.ConnectionString);
        DataSet ds = new DataSet();
        string _userid = GlobalVariable.WSInfo.UserID;

        public frmAllTaskOfAUserDeadline()
        {
            InitializeComponent();
        }

        private void frmAllTaskOfAUserDeadline_Load(object sender, EventArgs e)
        {
            LoadData();
        }

        #region "Coding"
        private void LoadData()
        {
            // LoadTaskOfUserDeadline to grid
            LoadTaskOfUserDeadline(_userid);
            gridControl_Data.DataSource = ds.Tables["TableTaskOfAUserDeadline"];
        }

        private void LoadTaskOfUserDeadline(string userid)
        {
            try
            {
                if (ds.Tables["TableTaskOfAUserDeadline"] != null)
                    ds.Tables["TableTaskOfAUserDeadline"].Clear();
                string sql = @"usp_AllTaskOfAUserDeadline @userid = '" + userid + "'";
                SqlDataAdapter da = new SqlDataAdapter(sql, conn);
                da.Fill(ds, "TableTaskOfAUserDeadline");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        #endregion
    }
}
